{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Box- and violin plots\n",
    "\n",
    "To visualize distribution properties a box plot can be used. It enables to identify the mean, the median, the inter quartile range and outliers. Violin plots are similar to density histograms but with frequency smoothing. A combined approach shows statistical properties by box plots and the distribution shape by violin plots. "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "dotnet_interactive": {
     "language": "fsharp"
    },
    "vscode": {
     "languageId": "dotnet-interactive.fsharp"
    }
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div><div></div><div></div><div><strong>Installed Packages</strong><ul><li><span>FSharp.Stats, 0.4.7</span></li><li><span>Plotly.NET.Interactive, 3.0.2</span></li></ul></div></div>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "// Referencing Plotly.NET.Interactive extension\n",
    "#r \"nuget: Plotly.NET.Interactive, 3.0.2\"\n",
    "\n",
    "// To generate samples from distributions, FSharp.Stats is referenced\n",
    "#r \"nuget: FSharp.Stats, 0.4.7\"\n",
    "\n",
    "open FSharp.Stats\n",
    "open Plotly.NET\n",
    "open Plotly.NET.StyleParam\n",
    "open Plotly.NET.LayoutObjects\n",
    "open Plotly.NET.TraceObjects"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "dotnet_interactive": {
     "language": "fsharp"
    },
    "vscode": {
     "languageId": "dotnet-interactive.fsharp"
    }
   },
   "outputs": [],
   "source": [
    "// Two normal distributions are generated with mean 4 and 6, and standard deviations of 1.0 and 0.5\n",
    "let distributionA = Distributions.Continuous.normal 4. 1.\n",
    "let distributionB = Distributions.Continuous.normal 6. 0.5\n",
    "\n",
    "// Samples of size 100 are drawn from both distributions and are appended to a combined sample (n=200).\n",
    "let sampleDistA = List.init 100 (fun _ -> distributionA.Sample()) \n",
    "let sampleDistB = List.init 100 (fun _ -> distributionB.Sample()) \n",
    "let combinedSample = sampleDistA@sampleDistB\n",
    "\n",
    "// box plot\n",
    "let boxPlot =\n",
    "    Chart.BoxPlot(\n",
    "        // defines the dimension the resulting plot should span\n",
    "        Y=combinedSample,\n",
    "        // defines the trace name\n",
    "        Name = \"myBoxPlot\",\n",
    "        // if box points are shown, the jitter defines the (horizontal) spread of the points\n",
    "        Jitter=0.5,\n",
    "        // defines if/which points are shown\n",
    "        BoxPoints=BoxPoints.All,\n",
    "        // defines if a dashed line is added to show the distribution mean\n",
    "        BoxMean=BoxMean.True\n",
    "        )\n",
    "\n",
    "// notched box plot\n",
    "let boxPlotNotch =\n",
    "    Chart.BoxPlot(\n",
    "        Y=combinedSample,\n",
    "        Name = \"myNotchedBoxPlot\",\n",
    "        // alters the shape of the box, indicating the 0.95 confidence interval for median differences\n",
    "        Notched=true\n",
    "        )\n",
    "\n",
    "// violin plot\n",
    "let violinPlot =\n",
    "    Chart.Violin (\n",
    "        Y=combinedSample,\n",
    "        Name=\"myViolin\",\n",
    "        Jitter=0.3,\n",
    "        Points=StyleParam.JitterPoints.All,\n",
    "        // defines the x axis offset to show the points\n",
    "        PointPos= 2.,\n",
    "        // defines if a mean line is added\n",
    "        MeanLine=MeanLine.init(Visible=true)\n",
    "        )\n",
    "\n",
    "// combined box and violin plot\n",
    "let violinBoxPlot =\n",
    "    Chart.Violin (\n",
    "        Y=combinedSample,\n",
    "        Name=\"myBoxViolin\",\n",
    "        // a box plot is added to the violin\n",
    "        ShowBox=true,\n",
    "        // defines the bandwidth of the density smoothing\n",
    "        BandWidth = 0.1\n",
    "        )\n",
    "\n",
    "// right part of violin plot\n",
    "let violinRight =\n",
    "    Chart.Violin (\n",
    "        Y=combinedSample,\n",
    "        Name=\"shared\",\n",
    "        BandWidth = 0.1,\n",
    "        // defines which side of the violin should be shown\n",
    "        Side=ViolinSide.Positive\n",
    "        )\n",
    "\n",
    "// left part of violin plot\n",
    "let violinLeft =\n",
    "    Chart.Violin (\n",
    "        Y = combinedSample,\n",
    "        Name = \"shared\",\n",
    "        BandWidth = 0.2,\n",
    "        Side = ViolinSide.Negative\n",
    "        )"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "dotnet_interactive": {
     "language": "fsharp"
    },
    "vscode": {
     "languageId": "dotnet-interactive.fsharp"
    }
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "<div>\n",
       "    <div id=\"141f3777-21a6-485d-a672-29910b0a074e\"><!-- Plotly chart will be drawn inside this DIV --></div>\r\n",
       "<script type=\"text/javascript\">\r\n",
       "\r\n",
       "            var renderPlotly_141f377721a6485da67229910b0a074e = function() {\r\n",
       "            var fsharpPlotlyRequire = requirejs.config({context:'fsharp-plotly',paths:{plotly:'https://cdn.plot.ly/plotly-2.6.3.min'}}) || require;\r\n",
       "            fsharpPlotlyRequire(['plotly'], function(Plotly) {\r\n",
       "\r\n",
       "            var data = [{\"type\":\"box\",\"name\":\"myBoxPlot\",\"y\":[3.434762850098813,2.3421093385057827,3.9469353607766635,5.397092023957697,3.2313713203901866,3.811545332327662,4.386577467081651,3.0307930006146213,5.75454272838721,5.063481462393569,4.819854764350006,3.45495932943582,5.469360514784996,6.022037563966938,3.919747543425863,3.0507089033196273,4.056746344300774,4.356546575356185,5.855387857307033,3.3205823116207958,4.847620879216347,4.67439480877162,5.52520702841826,2.069551854162757,3.628243187109284,5.288803123027026,4.041419879589421,3.4623453810085567,4.265597220861438,3.985597557870673,3.4384996168962787,5.486630964700736,5.748644282542495,5.104793136061609,3.7435094974489087,5.883379505894263,4.342674756947645,3.6945603482625127,3.978723111097815,4.537946887085209,2.5368546907307246,2.999987913431693,3.0497748428324467,3.3492625687045976,3.784101706608382,5.636671910135342,1.3492976518460202,3.339617604053973,4.997976056358062,4.111743888413283,5.782042526036435,3.016839545755917,2.537830226871872,4.53605356402472,2.302168314845665,6.044050554539378,4.9035226846570446,4.756333124766891,4.5312599303184165,3.9009491322723866,5.452534056782207,4.118891402014691,4.1700081358445376,4.701817085559183,3.67885447533985,3.6312988547820364,5.895606609776441,3.017470476829085,2.8638713203352966,4.326205266702982,3.1687641317786426,3.1726939940548173,5.236912039352899,3.3454789095415536,4.742271848042989,4.216987505995301,3.324866680511744,4.626696668036004,3.662738408338293,4.3257282895130915,4.505243094885776,4.2891360293395495,4.3147288193893605,2.040908063315504,4.544979329798935,4.077476319985345,2.757321727189125,4.894721883567602,5.287920322684532,4.304682402429313,3.0939890729490998,3.3794770565568943,5.4270729723848135,3.1405914161991726,4.6265260619326165,3.8557023934253922,3.440685826046978,4.016040352961745,4.294219311083994,2.0081921139957988,6.285356499444549,6.064153008409102,5.880241340388649,6.6223232429745895,6.169168420238723,6.429107594595837,5.769685247223682,5.848744714529327,6.251890171796132,5.76500964778936,5.700532717826761,6.884517349882881,6.022018287175735,5.330818147434951,5.5569794112737485,5.437642960221527,6.350229217325545,6.603957814883055,6.409076428140429,4.849384851982292,5.223432396305325,6.721596690564971,5.536625131830741,5.508519382040802,6.566713270015005,6.155049314924862,5.466542913296263,7.002612904667673,5.586079016067021,5.669399082897956,5.860934158126535,6.551218599516336,6.209723563631235,6.626058486410379,5.398838809511968,6.820236923402324,5.473167815059715,6.679262478105867,6.0795188184974975,6.343582820525641,6.234938963313429,6.258126019819655,5.704070299564952,6.421417913071318,5.8520489479608635,5.924031781728761,6.409681553635734,6.339180305694557,6.036691530559505,6.599782659855703,6.646502755406873,5.315164727969342,7.330879466237267,6.278086617913958,5.693109118613545,5.789667678061829,5.5680822382433615,5.208947252537325,6.048491240062672,6.615287981388708,6.222893794322625,6.231750731733093,5.921771658949303,6.124895508943895,6.621453964755312,6.337223754792176,5.913116480897077,5.679060927932744,6.514091584973479,5.377426468581148,5.668539903444497,5.6134596429669665,5.828998093662637,5.928176425811669,6.546098912083242,5.403480201771927,5.524739212884024,5.953014315413055,5.980106035285222,5.611455288753994,6.009266099823427,5.944596133182009,6.720568053362157,5.584773092316452,6.217740848456115,6.269175305805609,6.725566983525462,5.195139053201855,5.942112847478601,6.699272671842581,6.5447993123907,5.925426297180059,5.400247518056781,6.158031244260297,5.176591688544502,5.836735579319769,6.4071026789390055,6.278351430425699,5.1476164100092054,5.916033075646674],\"marker\":{},\"line\":{},\"boxmean\":true,\"boxpoints\":\"all\",\"jitter\":0.5},{\"type\":\"box\",\"name\":\"myNotchedBoxPlot\",\"y\":[3.434762850098813,2.3421093385057827,3.9469353607766635,5.397092023957697,3.2313713203901866,3.811545332327662,4.386577467081651,3.0307930006146213,5.75454272838721,5.063481462393569,4.819854764350006,3.45495932943582,5.469360514784996,6.022037563966938,3.919747543425863,3.0507089033196273,4.056746344300774,4.356546575356185,5.855387857307033,3.3205823116207958,4.847620879216347,4.67439480877162,5.52520702841826,2.069551854162757,3.628243187109284,5.288803123027026,4.041419879589421,3.4623453810085567,4.265597220861438,3.985597557870673,3.4384996168962787,5.486630964700736,5.748644282542495,5.104793136061609,3.7435094974489087,5.883379505894263,4.342674756947645,3.6945603482625127,3.978723111097815,4.537946887085209,2.5368546907307246,2.999987913431693,3.0497748428324467,3.3492625687045976,3.784101706608382,5.636671910135342,1.3492976518460202,3.339617604053973,4.997976056358062,4.111743888413283,5.782042526036435,3.016839545755917,2.537830226871872,4.53605356402472,2.302168314845665,6.044050554539378,4.9035226846570446,4.756333124766891,4.5312599303184165,3.9009491322723866,5.452534056782207,4.118891402014691,4.1700081358445376,4.701817085559183,3.67885447533985,3.6312988547820364,5.895606609776441,3.017470476829085,2.8638713203352966,4.326205266702982,3.1687641317786426,3.1726939940548173,5.236912039352899,3.3454789095415536,4.742271848042989,4.216987505995301,3.324866680511744,4.626696668036004,3.662738408338293,4.3257282895130915,4.505243094885776,4.2891360293395495,4.3147288193893605,2.040908063315504,4.544979329798935,4.077476319985345,2.757321727189125,4.894721883567602,5.287920322684532,4.304682402429313,3.0939890729490998,3.3794770565568943,5.4270729723848135,3.1405914161991726,4.6265260619326165,3.8557023934253922,3.440685826046978,4.016040352961745,4.294219311083994,2.0081921139957988,6.285356499444549,6.064153008409102,5.880241340388649,6.6223232429745895,6.169168420238723,6.429107594595837,5.769685247223682,5.848744714529327,6.251890171796132,5.76500964778936,5.700532717826761,6.884517349882881,6.022018287175735,5.330818147434951,5.5569794112737485,5.437642960221527,6.350229217325545,6.603957814883055,6.409076428140429,4.849384851982292,5.223432396305325,6.721596690564971,5.536625131830741,5.508519382040802,6.566713270015005,6.155049314924862,5.466542913296263,7.002612904667673,5.586079016067021,5.669399082897956,5.860934158126535,6.551218599516336,6.209723563631235,6.626058486410379,5.398838809511968,6.820236923402324,5.473167815059715,6.679262478105867,6.0795188184974975,6.343582820525641,6.234938963313429,6.258126019819655,5.704070299564952,6.421417913071318,5.8520489479608635,5.924031781728761,6.409681553635734,6.339180305694557,6.036691530559505,6.599782659855703,6.646502755406873,5.315164727969342,7.330879466237267,6.278086617913958,5.693109118613545,5.789667678061829,5.5680822382433615,5.208947252537325,6.048491240062672,6.615287981388708,6.222893794322625,6.231750731733093,5.921771658949303,6.124895508943895,6.621453964755312,6.337223754792176,5.913116480897077,5.679060927932744,6.514091584973479,5.377426468581148,5.668539903444497,5.6134596429669665,5.828998093662637,5.928176425811669,6.546098912083242,5.403480201771927,5.524739212884024,5.953014315413055,5.980106035285222,5.611455288753994,6.009266099823427,5.944596133182009,6.720568053362157,5.584773092316452,6.217740848456115,6.269175305805609,6.725566983525462,5.195139053201855,5.942112847478601,6.699272671842581,6.5447993123907,5.925426297180059,5.400247518056781,6.158031244260297,5.176591688544502,5.836735579319769,6.4071026789390055,6.278351430425699,5.1476164100092054,5.916033075646674],\"marker\":{},\"line\":{},\"notched\":true},{\"type\":\"violin\",\"name\":\"myViolin\",\"y\":[3.434762850098813,2.3421093385057827,3.9469353607766635,5.397092023957697,3.2313713203901866,3.811545332327662,4.386577467081651,3.0307930006146213,5.75454272838721,5.063481462393569,4.819854764350006,3.45495932943582,5.469360514784996,6.022037563966938,3.919747543425863,3.0507089033196273,4.056746344300774,4.356546575356185,5.855387857307033,3.3205823116207958,4.847620879216347,4.67439480877162,5.52520702841826,2.069551854162757,3.628243187109284,5.288803123027026,4.041419879589421,3.4623453810085567,4.265597220861438,3.985597557870673,3.4384996168962787,5.486630964700736,5.748644282542495,5.104793136061609,3.7435094974489087,5.883379505894263,4.342674756947645,3.6945603482625127,3.978723111097815,4.537946887085209,2.5368546907307246,2.999987913431693,3.0497748428324467,3.3492625687045976,3.784101706608382,5.636671910135342,1.3492976518460202,3.339617604053973,4.997976056358062,4.111743888413283,5.782042526036435,3.016839545755917,2.537830226871872,4.53605356402472,2.302168314845665,6.044050554539378,4.9035226846570446,4.756333124766891,4.5312599303184165,3.9009491322723866,5.452534056782207,4.118891402014691,4.1700081358445376,4.701817085559183,3.67885447533985,3.6312988547820364,5.895606609776441,3.017470476829085,2.8638713203352966,4.326205266702982,3.1687641317786426,3.1726939940548173,5.236912039352899,3.3454789095415536,4.742271848042989,4.216987505995301,3.324866680511744,4.626696668036004,3.662738408338293,4.3257282895130915,4.505243094885776,4.2891360293395495,4.3147288193893605,2.040908063315504,4.544979329798935,4.077476319985345,2.757321727189125,4.894721883567602,5.287920322684532,4.304682402429313,3.0939890729490998,3.3794770565568943,5.4270729723848135,3.1405914161991726,4.6265260619326165,3.8557023934253922,3.440685826046978,4.016040352961745,4.294219311083994,2.0081921139957988,6.285356499444549,6.064153008409102,5.880241340388649,6.6223232429745895,6.169168420238723,6.429107594595837,5.769685247223682,5.848744714529327,6.251890171796132,5.76500964778936,5.700532717826761,6.884517349882881,6.022018287175735,5.330818147434951,5.5569794112737485,5.437642960221527,6.350229217325545,6.603957814883055,6.409076428140429,4.849384851982292,5.223432396305325,6.721596690564971,5.536625131830741,5.508519382040802,6.566713270015005,6.155049314924862,5.466542913296263,7.002612904667673,5.586079016067021,5.669399082897956,5.860934158126535,6.551218599516336,6.209723563631235,6.626058486410379,5.398838809511968,6.820236923402324,5.473167815059715,6.679262478105867,6.0795188184974975,6.343582820525641,6.234938963313429,6.258126019819655,5.704070299564952,6.421417913071318,5.8520489479608635,5.924031781728761,6.409681553635734,6.339180305694557,6.036691530559505,6.599782659855703,6.646502755406873,5.315164727969342,7.330879466237267,6.278086617913958,5.693109118613545,5.789667678061829,5.5680822382433615,5.208947252537325,6.048491240062672,6.615287981388708,6.222893794322625,6.231750731733093,5.921771658949303,6.124895508943895,6.621453964755312,6.337223754792176,5.913116480897077,5.679060927932744,6.514091584973479,5.377426468581148,5.668539903444497,5.6134596429669665,5.828998093662637,5.928176425811669,6.546098912083242,5.403480201771927,5.524739212884024,5.953014315413055,5.980106035285222,5.611455288753994,6.009266099823427,5.944596133182009,6.720568053362157,5.584773092316452,6.217740848456115,6.269175305805609,6.725566983525462,5.195139053201855,5.942112847478601,6.699272671842581,6.5447993123907,5.925426297180059,5.400247518056781,6.158031244260297,5.176591688544502,5.836735579319769,6.4071026789390055,6.278351430425699,5.1476164100092054,5.916033075646674],\"marker\":{},\"line\":{},\"box\":{},\"pointpos\":2.0,\"jitter\":0.3,\"meanline\":{\"visible\":true},\"points\":\"all\"},{\"type\":\"violin\",\"name\":\"myBoxViolin\",\"y\":[3.434762850098813,2.3421093385057827,3.9469353607766635,5.397092023957697,3.2313713203901866,3.811545332327662,4.386577467081651,3.0307930006146213,5.75454272838721,5.063481462393569,4.819854764350006,3.45495932943582,5.469360514784996,6.022037563966938,3.919747543425863,3.0507089033196273,4.056746344300774,4.356546575356185,5.855387857307033,3.3205823116207958,4.847620879216347,4.67439480877162,5.52520702841826,2.069551854162757,3.628243187109284,5.288803123027026,4.041419879589421,3.4623453810085567,4.265597220861438,3.985597557870673,3.4384996168962787,5.486630964700736,5.748644282542495,5.104793136061609,3.7435094974489087,5.883379505894263,4.342674756947645,3.6945603482625127,3.978723111097815,4.537946887085209,2.5368546907307246,2.999987913431693,3.0497748428324467,3.3492625687045976,3.784101706608382,5.636671910135342,1.3492976518460202,3.339617604053973,4.997976056358062,4.111743888413283,5.782042526036435,3.016839545755917,2.537830226871872,4.53605356402472,2.302168314845665,6.044050554539378,4.9035226846570446,4.756333124766891,4.5312599303184165,3.9009491322723866,5.452534056782207,4.118891402014691,4.1700081358445376,4.701817085559183,3.67885447533985,3.6312988547820364,5.895606609776441,3.017470476829085,2.8638713203352966,4.326205266702982,3.1687641317786426,3.1726939940548173,5.236912039352899,3.3454789095415536,4.742271848042989,4.216987505995301,3.324866680511744,4.626696668036004,3.662738408338293,4.3257282895130915,4.505243094885776,4.2891360293395495,4.3147288193893605,2.040908063315504,4.544979329798935,4.077476319985345,2.757321727189125,4.894721883567602,5.287920322684532,4.304682402429313,3.0939890729490998,3.3794770565568943,5.4270729723848135,3.1405914161991726,4.6265260619326165,3.8557023934253922,3.440685826046978,4.016040352961745,4.294219311083994,2.0081921139957988,6.285356499444549,6.064153008409102,5.880241340388649,6.6223232429745895,6.169168420238723,6.429107594595837,5.769685247223682,5.848744714529327,6.251890171796132,5.76500964778936,5.700532717826761,6.884517349882881,6.022018287175735,5.330818147434951,5.5569794112737485,5.437642960221527,6.350229217325545,6.603957814883055,6.409076428140429,4.849384851982292,5.223432396305325,6.721596690564971,5.536625131830741,5.508519382040802,6.566713270015005,6.155049314924862,5.466542913296263,7.002612904667673,5.586079016067021,5.669399082897956,5.860934158126535,6.551218599516336,6.209723563631235,6.626058486410379,5.398838809511968,6.820236923402324,5.473167815059715,6.679262478105867,6.0795188184974975,6.343582820525641,6.234938963313429,6.258126019819655,5.704070299564952,6.421417913071318,5.8520489479608635,5.924031781728761,6.409681553635734,6.339180305694557,6.036691530559505,6.599782659855703,6.646502755406873,5.315164727969342,7.330879466237267,6.278086617913958,5.693109118613545,5.789667678061829,5.5680822382433615,5.208947252537325,6.048491240062672,6.615287981388708,6.222893794322625,6.231750731733093,5.921771658949303,6.124895508943895,6.621453964755312,6.337223754792176,5.913116480897077,5.679060927932744,6.514091584973479,5.377426468581148,5.668539903444497,5.6134596429669665,5.828998093662637,5.928176425811669,6.546098912083242,5.403480201771927,5.524739212884024,5.953014315413055,5.980106035285222,5.611455288753994,6.009266099823427,5.944596133182009,6.720568053362157,5.584773092316452,6.217740848456115,6.269175305805609,6.725566983525462,5.195139053201855,5.942112847478601,6.699272671842581,6.5447993123907,5.925426297180059,5.400247518056781,6.158031244260297,5.176591688544502,5.836735579319769,6.4071026789390055,6.278351430425699,5.1476164100092054,5.916033075646674],\"marker\":{},\"line\":{},\"box\":{\"visible\":true},\"bandwidth\":0.1},{\"type\":\"violin\",\"name\":\"shared\",\"y\":[3.434762850098813,2.3421093385057827,3.9469353607766635,5.397092023957697,3.2313713203901866,3.811545332327662,4.386577467081651,3.0307930006146213,5.75454272838721,5.063481462393569,4.819854764350006,3.45495932943582,5.469360514784996,6.022037563966938,3.919747543425863,3.0507089033196273,4.056746344300774,4.356546575356185,5.855387857307033,3.3205823116207958,4.847620879216347,4.67439480877162,5.52520702841826,2.069551854162757,3.628243187109284,5.288803123027026,4.041419879589421,3.4623453810085567,4.265597220861438,3.985597557870673,3.4384996168962787,5.486630964700736,5.748644282542495,5.104793136061609,3.7435094974489087,5.883379505894263,4.342674756947645,3.6945603482625127,3.978723111097815,4.537946887085209,2.5368546907307246,2.999987913431693,3.0497748428324467,3.3492625687045976,3.784101706608382,5.636671910135342,1.3492976518460202,3.339617604053973,4.997976056358062,4.111743888413283,5.782042526036435,3.016839545755917,2.537830226871872,4.53605356402472,2.302168314845665,6.044050554539378,4.9035226846570446,4.756333124766891,4.5312599303184165,3.9009491322723866,5.452534056782207,4.118891402014691,4.1700081358445376,4.701817085559183,3.67885447533985,3.6312988547820364,5.895606609776441,3.017470476829085,2.8638713203352966,4.326205266702982,3.1687641317786426,3.1726939940548173,5.236912039352899,3.3454789095415536,4.742271848042989,4.216987505995301,3.324866680511744,4.626696668036004,3.662738408338293,4.3257282895130915,4.505243094885776,4.2891360293395495,4.3147288193893605,2.040908063315504,4.544979329798935,4.077476319985345,2.757321727189125,4.894721883567602,5.287920322684532,4.304682402429313,3.0939890729490998,3.3794770565568943,5.4270729723848135,3.1405914161991726,4.6265260619326165,3.8557023934253922,3.440685826046978,4.016040352961745,4.294219311083994,2.0081921139957988,6.285356499444549,6.064153008409102,5.880241340388649,6.6223232429745895,6.169168420238723,6.429107594595837,5.769685247223682,5.848744714529327,6.251890171796132,5.76500964778936,5.700532717826761,6.884517349882881,6.022018287175735,5.330818147434951,5.5569794112737485,5.437642960221527,6.350229217325545,6.603957814883055,6.409076428140429,4.849384851982292,5.223432396305325,6.721596690564971,5.536625131830741,5.508519382040802,6.566713270015005,6.155049314924862,5.466542913296263,7.002612904667673,5.586079016067021,5.669399082897956,5.860934158126535,6.551218599516336,6.209723563631235,6.626058486410379,5.398838809511968,6.820236923402324,5.473167815059715,6.679262478105867,6.0795188184974975,6.343582820525641,6.234938963313429,6.258126019819655,5.704070299564952,6.421417913071318,5.8520489479608635,5.924031781728761,6.409681553635734,6.339180305694557,6.036691530559505,6.599782659855703,6.646502755406873,5.315164727969342,7.330879466237267,6.278086617913958,5.693109118613545,5.789667678061829,5.5680822382433615,5.208947252537325,6.048491240062672,6.615287981388708,6.222893794322625,6.231750731733093,5.921771658949303,6.124895508943895,6.621453964755312,6.337223754792176,5.913116480897077,5.679060927932744,6.514091584973479,5.377426468581148,5.668539903444497,5.6134596429669665,5.828998093662637,5.928176425811669,6.546098912083242,5.403480201771927,5.524739212884024,5.953014315413055,5.980106035285222,5.611455288753994,6.009266099823427,5.944596133182009,6.720568053362157,5.584773092316452,6.217740848456115,6.269175305805609,6.725566983525462,5.195139053201855,5.942112847478601,6.699272671842581,6.5447993123907,5.925426297180059,5.400247518056781,6.158031244260297,5.176591688544502,5.836735579319769,6.4071026789390055,6.278351430425699,5.1476164100092054,5.916033075646674],\"marker\":{},\"line\":{},\"box\":{},\"bandwidth\":0.2,\"side\":\"negative\"},{\"type\":\"violin\",\"name\":\"shared\",\"y\":[3.434762850098813,2.3421093385057827,3.9469353607766635,5.397092023957697,3.2313713203901866,3.811545332327662,4.386577467081651,3.0307930006146213,5.75454272838721,5.063481462393569,4.819854764350006,3.45495932943582,5.469360514784996,6.022037563966938,3.919747543425863,3.0507089033196273,4.056746344300774,4.356546575356185,5.855387857307033,3.3205823116207958,4.847620879216347,4.67439480877162,5.52520702841826,2.069551854162757,3.628243187109284,5.288803123027026,4.041419879589421,3.4623453810085567,4.265597220861438,3.985597557870673,3.4384996168962787,5.486630964700736,5.748644282542495,5.104793136061609,3.7435094974489087,5.883379505894263,4.342674756947645,3.6945603482625127,3.978723111097815,4.537946887085209,2.5368546907307246,2.999987913431693,3.0497748428324467,3.3492625687045976,3.784101706608382,5.636671910135342,1.3492976518460202,3.339617604053973,4.997976056358062,4.111743888413283,5.782042526036435,3.016839545755917,2.537830226871872,4.53605356402472,2.302168314845665,6.044050554539378,4.9035226846570446,4.756333124766891,4.5312599303184165,3.9009491322723866,5.452534056782207,4.118891402014691,4.1700081358445376,4.701817085559183,3.67885447533985,3.6312988547820364,5.895606609776441,3.017470476829085,2.8638713203352966,4.326205266702982,3.1687641317786426,3.1726939940548173,5.236912039352899,3.3454789095415536,4.742271848042989,4.216987505995301,3.324866680511744,4.626696668036004,3.662738408338293,4.3257282895130915,4.505243094885776,4.2891360293395495,4.3147288193893605,2.040908063315504,4.544979329798935,4.077476319985345,2.757321727189125,4.894721883567602,5.287920322684532,4.304682402429313,3.0939890729490998,3.3794770565568943,5.4270729723848135,3.1405914161991726,4.6265260619326165,3.8557023934253922,3.440685826046978,4.016040352961745,4.294219311083994,2.0081921139957988,6.285356499444549,6.064153008409102,5.880241340388649,6.6223232429745895,6.169168420238723,6.429107594595837,5.769685247223682,5.848744714529327,6.251890171796132,5.76500964778936,5.700532717826761,6.884517349882881,6.022018287175735,5.330818147434951,5.5569794112737485,5.437642960221527,6.350229217325545,6.603957814883055,6.409076428140429,4.849384851982292,5.223432396305325,6.721596690564971,5.536625131830741,5.508519382040802,6.566713270015005,6.155049314924862,5.466542913296263,7.002612904667673,5.586079016067021,5.669399082897956,5.860934158126535,6.551218599516336,6.209723563631235,6.626058486410379,5.398838809511968,6.820236923402324,5.473167815059715,6.679262478105867,6.0795188184974975,6.343582820525641,6.234938963313429,6.258126019819655,5.704070299564952,6.421417913071318,5.8520489479608635,5.924031781728761,6.409681553635734,6.339180305694557,6.036691530559505,6.599782659855703,6.646502755406873,5.315164727969342,7.330879466237267,6.278086617913958,5.693109118613545,5.789667678061829,5.5680822382433615,5.208947252537325,6.048491240062672,6.615287981388708,6.222893794322625,6.231750731733093,5.921771658949303,6.124895508943895,6.621453964755312,6.337223754792176,5.913116480897077,5.679060927932744,6.514091584973479,5.377426468581148,5.668539903444497,5.6134596429669665,5.828998093662637,5.928176425811669,6.546098912083242,5.403480201771927,5.524739212884024,5.953014315413055,5.980106035285222,5.611455288753994,6.009266099823427,5.944596133182009,6.720568053362157,5.584773092316452,6.217740848456115,6.269175305805609,6.725566983525462,5.195139053201855,5.942112847478601,6.699272671842581,6.5447993123907,5.925426297180059,5.400247518056781,6.158031244260297,5.176591688544502,5.836735579319769,6.4071026789390055,6.278351430425699,5.1476164100092054,5.916033075646674],\"marker\":{},\"line\":{},\"box\":{},\"bandwidth\":0.1,\"side\":\"positive\"}];\r\n",
       "            var layout = {\"width\":900,\"height\":900,\"template\":{\"layout\":{\"title\":{\"x\":0.05},\"font\":{\"color\":\"rgba(42, 63, 95, 1.0)\"},\"paper_bgcolor\":\"rgba(255, 255, 255, 1.0)\",\"plot_bgcolor\":\"rgba(229, 236, 246, 1.0)\",\"autotypenumbers\":\"strict\",\"colorscale\":{\"diverging\":[[0.0,\"#8e0152\"],[0.1,\"#c51b7d\"],[0.2,\"#de77ae\"],[0.3,\"#f1b6da\"],[0.4,\"#fde0ef\"],[0.5,\"#f7f7f7\"],[0.6,\"#e6f5d0\"],[0.7,\"#b8e186\"],[0.8,\"#7fbc41\"],[0.9,\"#4d9221\"],[1.0,\"#276419\"]],\"sequential\":[[0.0,\"#0d0887\"],[0.1111111111111111,\"#46039f\"],[0.2222222222222222,\"#7201a8\"],[0.3333333333333333,\"#9c179e\"],[0.4444444444444444,\"#bd3786\"],[0.5555555555555556,\"#d8576b\"],[0.6666666666666666,\"#ed7953\"],[0.7777777777777778,\"#fb9f3a\"],[0.8888888888888888,\"#fdca26\"],[1.0,\"#f0f921\"]],\"sequentialminus\":[[0.0,\"#0d0887\"],[0.1111111111111111,\"#46039f\"],[0.2222222222222222,\"#7201a8\"],[0.3333333333333333,\"#9c179e\"],[0.4444444444444444,\"#bd3786\"],[0.5555555555555556,\"#d8576b\"],[0.6666666666666666,\"#ed7953\"],[0.7777777777777778,\"#fb9f3a\"],[0.8888888888888888,\"#fdca26\"],[1.0,\"#f0f921\"]]},\"hovermode\":\"closest\",\"hoverlabel\":{\"align\":\"left\"},\"coloraxis\":{\"colorbar\":{\"outlinewidth\":0.0,\"ticks\":\"\"}},\"geo\":{\"showland\":true,\"landcolor\":\"rgba(229, 236, 246, 1.0)\",\"showlakes\":true,\"lakecolor\":\"rgba(255, 255, 255, 1.0)\",\"subunitcolor\":\"rgba(255, 255, 255, 1.0)\",\"bgcolor\":\"rgba(255, 255, 255, 1.0)\"},\"mapbox\":{\"style\":\"light\"},\"polar\":{\"bgcolor\":\"rgba(229, 236, 246, 1.0)\",\"radialaxis\":{\"linecolor\":\"rgba(255, 255, 255, 1.0)\",\"gridcolor\":\"rgba(255, 255, 255, 1.0)\",\"ticks\":\"\"},\"angularaxis\":{\"linecolor\":\"rgba(255, 255, 255, 1.0)\",\"gridcolor\":\"rgba(255, 255, 255, 1.0)\",\"ticks\":\"\"}},\"scene\":{\"xaxis\":{\"ticks\":\"\",\"linecolor\":\"rgba(255, 255, 255, 1.0)\",\"gridcolor\":\"rgba(255, 255, 255, 1.0)\",\"gridwidth\":2.0,\"zerolinecolor\":\"rgba(255, 255, 255, 1.0)\",\"backgroundcolor\":\"rgba(229, 236, 246, 1.0)\",\"showbackground\":true},\"yaxis\":{\"ticks\":\"\",\"linecolor\":\"rgba(255, 255, 255, 1.0)\",\"gridcolor\":\"rgba(255, 255, 255, 1.0)\",\"gridwidth\":2.0,\"zerolinecolor\":\"rgba(255, 255, 255, 1.0)\",\"backgroundcolor\":\"rgba(229, 236, 246, 1.0)\",\"showbackground\":true},\"zaxis\":{\"ticks\":\"\",\"linecolor\":\"rgba(255, 255, 255, 1.0)\",\"gridcolor\":\"rgba(255, 255, 255, 1.0)\",\"gridwidth\":2.0,\"zerolinecolor\":\"rgba(255, 255, 255, 1.0)\",\"backgroundcolor\":\"rgba(229, 236, 246, 1.0)\",\"showbackground\":true}},\"ternary\":{\"aaxis\":{\"ticks\":\"\",\"linecolor\":\"rgba(255, 255, 255, 1.0)\",\"gridcolor\":\"rgba(255, 255, 255, 1.0)\"},\"baxis\":{\"ticks\":\"\",\"linecolor\":\"rgba(255, 255, 255, 1.0)\",\"gridcolor\":\"rgba(255, 255, 255, 1.0)\"},\"caxis\":{\"ticks\":\"\",\"linecolor\":\"rgba(255, 255, 255, 1.0)\",\"gridcolor\":\"rgba(255, 255, 255, 1.0)\"},\"bgcolor\":\"rgba(229, 236, 246, 1.0)\"},\"xaxis\":{\"title\":{\"standoff\":15},\"ticks\":\"\",\"automargin\":true,\"linecolor\":\"rgba(255, 255, 255, 1.0)\",\"gridcolor\":\"rgba(255, 255, 255, 1.0)\",\"zerolinecolor\":\"rgba(255, 255, 255, 1.0)\",\"zerolinewidth\":2.0},\"yaxis\":{\"title\":{\"standoff\":15},\"ticks\":\"\",\"automargin\":true,\"linecolor\":\"rgba(255, 255, 255, 1.0)\",\"gridcolor\":\"rgba(255, 255, 255, 1.0)\",\"zerolinecolor\":\"rgba(255, 255, 255, 1.0)\",\"zerolinewidth\":2.0},\"annotationdefaults\":{\"arrowcolor\":\"#2a3f5f\",\"arrowhead\":0,\"arrowwidth\":1},\"shapedefaults\":{\"line\":{\"color\":\"rgba(42, 63, 95, 1.0)\"}},\"colorway\":[\"rgba(99, 110, 250, 1.0)\",\"rgba(239, 85, 59, 1.0)\",\"rgba(0, 204, 150, 1.0)\",\"rgba(171, 99, 250, 1.0)\",\"rgba(255, 161, 90, 1.0)\",\"rgba(25, 211, 243, 1.0)\",\"rgba(255, 102, 146, 1.0)\",\"rgba(182, 232, 128, 1.0)\",\"rgba(255, 151, 255, 1.0)\",\"rgba(254, 203, 82, 1.0)\"]},\"data\":{\"bar\":[{\"marker\":{\"line\":{\"color\":\"rgba(229, 236, 246, 1.0)\",\"width\":0.5},\"pattern\":{\"fillmode\":\"overlay\",\"size\":10,\"solidity\":0.2}},\"error_x\":{\"color\":\"rgba(42, 63, 95, 1.0)\"},\"error_y\":{\"color\":\"rgba(42, 63, 95, 1.0)\"}}],\"barpolar\":[{\"marker\":{\"line\":{\"color\":\"rgba(229, 236, 246, 1.0)\",\"width\":0.5},\"pattern\":{\"fillmode\":\"overlay\",\"size\":10,\"solidity\":0.2}}}],\"carpet\":[{\"aaxis\":{\"linecolor\":\"rgba(255, 255, 255, 1.0)\",\"gridcolor\":\"rgba(255, 255, 255, 1.0)\",\"endlinecolor\":\"rgba(42, 63, 95, 1.0)\",\"minorgridcolor\":\"rgba(255, 255, 255, 1.0)\",\"startlinecolor\":\"rgba(42, 63, 95, 1.0)\"},\"baxis\":{\"linecolor\":\"rgba(255, 255, 255, 1.0)\",\"gridcolor\":\"rgba(255, 255, 255, 1.0)\",\"endlinecolor\":\"rgba(42, 63, 95, 1.0)\",\"minorgridcolor\":\"rgba(255, 255, 255, 1.0)\",\"startlinecolor\":\"rgba(42, 63, 95, 1.0)\"}}],\"choropleth\":[{\"colorbar\":{\"outlinewidth\":0.0,\"ticks\":\"\"},\"colorscale\":[[0.0,\"#0d0887\"],[0.1111111111111111,\"#46039f\"],[0.2222222222222222,\"#7201a8\"],[0.3333333333333333,\"#9c179e\"],[0.4444444444444444,\"#bd3786\"],[0.5555555555555556,\"#d8576b\"],[0.6666666666666666,\"#ed7953\"],[0.7777777777777778,\"#fb9f3a\"],[0.8888888888888888,\"#fdca26\"],[1.0,\"#f0f921\"]]}],\"contour\":[{\"colorbar\":{\"outlinewidth\":0.0,\"ticks\":\"\"},\"colorscale\":[[0.0,\"#0d0887\"],[0.1111111111111111,\"#46039f\"],[0.2222222222222222,\"#7201a8\"],[0.3333333333333333,\"#9c179e\"],[0.4444444444444444,\"#bd3786\"],[0.5555555555555556,\"#d8576b\"],[0.6666666666666666,\"#ed7953\"],[0.7777777777777778,\"#fb9f3a\"],[0.8888888888888888,\"#fdca26\"],[1.0,\"#f0f921\"]]}],\"contourcarpet\":[{\"colorbar\":{\"outlinewidth\":0.0,\"ticks\":\"\"}}],\"heatmap\":[{\"colorbar\":{\"outlinewidth\":0.0,\"ticks\":\"\"},\"colorscale\":[[0.0,\"#0d0887\"],[0.1111111111111111,\"#46039f\"],[0.2222222222222222,\"#7201a8\"],[0.3333333333333333,\"#9c179e\"],[0.4444444444444444,\"#bd3786\"],[0.5555555555555556,\"#d8576b\"],[0.6666666666666666,\"#ed7953\"],[0.7777777777777778,\"#fb9f3a\"],[0.8888888888888888,\"#fdca26\"],[1.0,\"#f0f921\"]]}],\"heatmapgl\":[{\"colorbar\":{\"outlinewidth\":0.0,\"ticks\":\"\"},\"colorscale\":[[0.0,\"#0d0887\"],[0.1111111111111111,\"#46039f\"],[0.2222222222222222,\"#7201a8\"],[0.3333333333333333,\"#9c179e\"],[0.4444444444444444,\"#bd3786\"],[0.5555555555555556,\"#d8576b\"],[0.6666666666666666,\"#ed7953\"],[0.7777777777777778,\"#fb9f3a\"],[0.8888888888888888,\"#fdca26\"],[1.0,\"#f0f921\"]]}],\"histogram\":[{\"marker\":{\"pattern\":{\"fillmode\":\"overlay\",\"size\":10,\"solidity\":0.2}}}],\"histogram2d\":[{\"colorbar\":{\"outlinewidth\":0.0,\"ticks\":\"\"},\"colorscale\":[[0.0,\"#0d0887\"],[0.1111111111111111,\"#46039f\"],[0.2222222222222222,\"#7201a8\"],[0.3333333333333333,\"#9c179e\"],[0.4444444444444444,\"#bd3786\"],[0.5555555555555556,\"#d8576b\"],[0.6666666666666666,\"#ed7953\"],[0.7777777777777778,\"#fb9f3a\"],[0.8888888888888888,\"#fdca26\"],[1.0,\"#f0f921\"]]}],\"histogram2dcontour\":[{\"colorbar\":{\"outlinewidth\":0.0,\"ticks\":\"\"},\"colorscale\":[[0.0,\"#0d0887\"],[0.1111111111111111,\"#46039f\"],[0.2222222222222222,\"#7201a8\"],[0.3333333333333333,\"#9c179e\"],[0.4444444444444444,\"#bd3786\"],[0.5555555555555556,\"#d8576b\"],[0.6666666666666666,\"#ed7953\"],[0.7777777777777778,\"#fb9f3a\"],[0.8888888888888888,\"#fdca26\"],[1.0,\"#f0f921\"]]}],\"mesh3d\":[{\"colorbar\":{\"outlinewidth\":0.0,\"ticks\":\"\"}}],\"parcoords\":[{\"line\":{\"colorbar\":{\"outlinewidth\":0.0,\"ticks\":\"\"}}}],\"pie\":[{\"automargin\":true}],\"scatter\":[{\"marker\":{\"colorbar\":{\"outlinewidth\":0.0,\"ticks\":\"\"}}}],\"scatter3d\":[{\"marker\":{\"colorbar\":{\"outlinewidth\":0.0,\"ticks\":\"\"}},\"line\":{\"colorbar\":{\"outlinewidth\":0.0,\"ticks\":\"\"}}}],\"scattercarpet\":[{\"marker\":{\"colorbar\":{\"outlinewidth\":0.0,\"ticks\":\"\"}}}],\"scattergeo\":[{\"marker\":{\"colorbar\":{\"outlinewidth\":0.0,\"ticks\":\"\"}}}],\"scattergl\":[{\"marker\":{\"colorbar\":{\"outlinewidth\":0.0,\"ticks\":\"\"}}}],\"scattermapbox\":[{\"marker\":{\"colorbar\":{\"outlinewidth\":0.0,\"ticks\":\"\"}}}],\"scatterpolar\":[{\"marker\":{\"colorbar\":{\"outlinewidth\":0.0,\"ticks\":\"\"}}}],\"scatterpolargl\":[{\"marker\":{\"colorbar\":{\"outlinewidth\":0.0,\"ticks\":\"\"}}}],\"scatterternary\":[{\"marker\":{\"colorbar\":{\"outlinewidth\":0.0,\"ticks\":\"\"}}}],\"surface\":[{\"colorbar\":{\"outlinewidth\":0.0,\"ticks\":\"\"},\"colorscale\":[[0.0,\"#0d0887\"],[0.1111111111111111,\"#46039f\"],[0.2222222222222222,\"#7201a8\"],[0.3333333333333333,\"#9c179e\"],[0.4444444444444444,\"#bd3786\"],[0.5555555555555556,\"#d8576b\"],[0.6666666666666666,\"#ed7953\"],[0.7777777777777778,\"#fb9f3a\"],[0.8888888888888888,\"#fdca26\"],[1.0,\"#f0f921\"]]}],\"table\":[{\"cells\":{\"fill\":{\"color\":\"rgba(235, 240, 248, 1.0)\"},\"line\":{\"color\":\"rgba(255, 255, 255, 1.0)\"}},\"header\":{\"fill\":{\"color\":\"rgba(200, 212, 227, 1.0)\"},\"line\":{\"color\":\"rgba(255, 255, 255, 1.0)\"}}}]}},\"legend\":{\"orientation\":\"h\",\"x\":0.05,\"y\":0.95}};\r\n",
       "            var config = {\"responsive\":true,\"toImageButtonOptions\":{\"format\":\"svg\"}};\r\n",
       "            Plotly.newPlot('141f3777-21a6-485d-a672-29910b0a074e', data, layout, config);\r\n",
       "});\r\n",
       "            };\r\n",
       "            if ((typeof(requirejs) !==  typeof(Function)) || (typeof(requirejs.config) !== typeof(Function))) {\r\n",
       "                var script = document.createElement(\"script\");\r\n",
       "                script.setAttribute(\"src\", \"https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.6/require.min.js\");\r\n",
       "                script.onload = function(){\r\n",
       "                    renderPlotly_141f377721a6485da67229910b0a074e();\r\n",
       "                };\r\n",
       "                document.getElementsByTagName(\"head\")[0].appendChild(script);\r\n",
       "            }\r\n",
       "            else {\r\n",
       "                renderPlotly_141f377721a6485da67229910b0a074e();\r\n",
       "            }\r\n",
       "</script>\r\n",
       "\n",
       "    \n",
       "</div>    \n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "// all generated box and violin plots are combined into a single plot\n",
    "let combinedBoxPlots =\n",
    "    [\n",
    "    boxPlot\n",
    "    boxPlotNotch\n",
    "    violinPlot\n",
    "    violinBoxPlot\n",
    "    violinLeft\n",
    "    violinRight\n",
    "    ]\n",
    "    |> Chart.combine\n",
    "    //|> Chart.withTemplate(ChartTemplates.lightMirrored)\n",
    "    // alters the \"Download plot\" button to export the plot as SVG \n",
    "    |> Chart.withConfig(Config.init(ToImageButtonOptions = ConfigObjects.ToImageButtonOptions.init(Format=ImageFormat.SVG)))\n",
    "    |> Chart.withSize(900.,900.)    \n",
    "    |> Chart.withLegendStyle(Orientation=Orientation.Horizontal,Y=0.95,X=0.05)\n",
    "    //|> Chart.withTitle(Title.init(\"Box and violin plots\",X=0.5))\n",
    "    //|> Chart.withLayoutStyle(PaperBGColor=Color.fromARGB 0 0 0 0,PlotBGColor=Color.fromHex \"#ffffff\")\n",
    "\n",
    "combinedBoxPlots"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": ".NET (F#)",
   "language": "F#",
   "name": ".net-fsharp"
  },
  "language_info": {
   "name": "F#"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
